import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout/myIndex'
import Login from '@/views/login/loginIndex'
import Home from '@/views/home/homeIndex.vue'


const Product = () => import('@/views/product/productIndex.vue')
const List = () => import('@/views/product/list/listIndex.vue')
const Category = () => import('@/views/product/category/categoryIndex.vue')

const Order = ()=>import('@/views/order/orderIndex.vue')
const OrderList = ()=>import('@/views/order/list/listIndex.vue')
const Collect = ()=>import('@/views/order/collect/collectIndex.vue')

const Adver = ()=>import('@/views/adver/adverIndex.vue')
const AdverList = ()=>import('@/views/adver/list/listIndex.vue')



Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    component: Layout,
    children: [{
      path: '/',
      name: 'home',
      component: Home
    },
          // 产品管理
    {
      path: '/product', 
      name: 'product',
      component: Product,
      children: [{
        // 访问路劲：/product/list
        path: 'list',
        name: 'list',
        component: List
      },
      {
        // 访问路劲：/product/list
        path: 'category',
        name: 'category',
        component: Category
      },]
    },
          // 订单管理
    {
      path: '/order', 
      name: 'order',
      component: Order,
      children: [{
        // 访问路劲：
        path: 'orderList',
        name: 'orderList',
        component: OrderList
      },
      {
        // 访问路劲：
        path: 'collect',
        name: 'collect',
        component: Collect
      },]
    },
          // 广告管理
    {
      path: '/adver', 
      name: 'adver',
      component: Adver,
      children: [{
        // 访问路劲：
        path: 'adverList',
        name: 'adverList',
        component: AdverList
      },]
    },  
  ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
